package org.op.editor;

import java.util.Map;

import javax.swing.JEditorPane;
import javax.swing.text.Document;

import org.op.ComponentView;
import org.op.service.WwDocumentInfo;

public interface EditorComponentView extends ComponentView {

	/**
	 *  Adds a new editor, given its document content, and metadata info object
	 * 
	 * @param content
	 * @param docInfo
	 */
	public void addEditor(Document content, WwDocumentInfo docInfo);
	
	/**
	 *   Removes the current editor from the view
	 *   
	 */
	public void removeSelectedEditor();
	

	/**
	 *  Returns the Map that repesents the editorPanel objects for all open editors
	 * 
	 * @return
	 */
	public Map<WwDocumentInfo, JEditorPane> getEditorPanes();
	
	/**
	 *  Returns the current pane
	 * 
	 * @return
	 */
	public JEditorPane getCurrentPane();
	
	/**
	 *  Returns the metadata information object for the currently edited document
	 *  
	 * @return
	 */
	public WwDocumentInfo getCurrentDocumentInfo();
	
	/**
	 * Mark the given tab as dirty (i.e; put an asterisk beside the label)
	 * 
	 * @param documentName
	 */
	public void setDirty(String documentName);
	
	/**
	 *  Mark the given tab as clean (remove the asterisk)
	 *  
	 * @param documentName
	 */
	public void setClean(String documentName);

	/**
	 * Set the current document to dirty
	 */
	public void setCurrentDirty();
	
	/**
	 *  Check to see if the current editor is "dirty" -- meaning that there are changes
	 * @return
	 */
	public boolean isCurrentDirty();

	/**
	 * Updates the docInfo of the currently edited document (for a save-as operation)
	 * 
	 * @param docInfo
	 */
	public void setCurrentDocumentInfo(WwDocumentInfo docInfo);
	
	/**
	 *  Returns the text of the current selection
	 * 
	 * @return
	 */
	public String getSelectedText();
	
	/**
	 *  Undo the last edit
	 */
	public void undoLastEdit();
	
	/**
	 *  Redo the last edit
	 */
	public void redoLastEdit();

}
